home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-20 | 3.9 KB | 198 lines | [TEXT/MPS ] |
- /****************************************************/
- /* */
- /* File: doevent.c */
- /* */
- /* Program: ChromaKeyMovie */
- /* */
- /* By: Jason Hodges-Harris */
- /* */
- /* Copyright: © 1995 by Apple Computer, Inc., */
- /* all rights reserved. */
- /* */
- /****************************************************/
-
-
-
-
- // Mac toolbox headers
-
- #ifndef __CURSORCTL__
- #include <CursorCtl.h>
- #endif
-
- #ifndef __DESK__
- #include <Desk.h>
- #endif
-
- #ifndef __DISKINIT__
- #include <DiskInit.h>
- #endif
-
- #ifndef __EVENTS__
- #include <Events.h>
- #endif
-
- #ifndef __MENUS__
- #include <Menus.h>
- #endif
-
- #ifndef __MOVIES__
- #include <Movies.h>
- #endif
-
- #ifndef __QDOFFSCREEN__
- #include <QDOffscreen.h>
- #endif
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
-
- // Program headers
-
- #ifndef __CHROMAPPHEADER__
- #include "ChromaKeyMovie.app.h"
- #endif
-
- #ifndef __CHROMAPROTOSHEADER__
- #include "ChromaKeyMovie.protos.h"
- #endif
-
- // Global Variables
-
- extern short gKeyMode;
- extern Boolean gMovieOpen;
-
-
- // DoEvent function processess the events posted by the application.
- // This includes the handling of the movie controller, mouse, key,
- // disk and operating system events.
-
- #pragma segment Main
- void DoEvent (EventRecord *eventPtr)
- {
- WindowPtr theWindow,
- theTempWindow;
- char theChar;
-
- theWindow = FrontWindow();
- theTempWindow = theWindow;
- if (gMovieOpen)
- {
- while (theTempWindow != nil)
- {
- MCIsPlayerEvent((**((MovieDocHndl)
- GetWRefCon(theTempWindow))).theController,eventPtr);
- theTempWindow = &(*(((WindowPeek)theTempWindow)->nextWindow)).port;
- }
- }
- switch (eventPtr->what)
- {
- case nullEvent:
- if (gMovieOpen)
- {
- switch (gKeyMode)
- {
- case transparentMode:
- TransparentKeyMode(theWindow); // use transparent transfer mode
- break;
- case graphix:
- break;
- case modifierTrax:
- break;
- }
- }
- break;
- case mouseDown:
- HandleMouseDown(eventPtr);
- break;
- case mouseUp:
- break;
- case keyDown:
- case autoKey:
- theChar=eventPtr->message & charCodeMask;
- if ((eventPtr->modifiers &cmdKey) !=0)
- DoMenuCommand(MenuKey (theChar));
- break;
- case keyUp:
- break;
- case updateEvt:
- DoWindUpdate((WindowPtr)(eventPtr->message));
- break;
- case diskEvt:
- DoDiskEvt(eventPtr); // disk inserted event
- break;
- case osEvt:
- if (eventPtr->message>>24==resumeFlag)
- //Show_Cursor(ARROW_CURSOR); // reset cursor
- SetCursor(&qd.arrow);
- break;
- }
- }
-
-
- // HandleMouseDown controls the further processing of mouse button down events.
- // This includes testing the location of the mouse pointer at the time of the event
- // and performing the appropriate action. e.g. if the mouse button was pressed
- // whilst the pointer was in the menubar, the value returned by MenuSelect()
- // (used to determine which menubar and item selected) is passed into DoMenuCommand()
- // which in turn handles the processing of the selected menu items.
-
- #pragma segment Main
- void HandleMouseDown(EventRecord *eventPtr)
- {
- WindowPtr window;
- short thePart;
- long menuChoice;
-
- thePart=FindWindow (eventPtr->where,&window);
- switch (thePart)
- {
- case inMenuBar:
- menuChoice = MenuSelect (eventPtr->where);
- DoMenuCommand(menuChoice);
- break;
- case inSysWindow:
- SystemClick(eventPtr,window);
- break;
- case inDrag:
- DragSelWind(window,eventPtr->where);
- case inGoAway:
- DoGoAwayWind(window,eventPtr->where);
- break;
- case inContent:
- {
- if(window!=FrontWindow())
- {
- SelectWindow(window);
- break;
- }
- }
- break;
- case osEvt:
- break;
- }
- }
-
-
- // DoDiskEvt handles the event post by the OS when a disk is insert
- // and displays an error is the media cannot be mounted.
-
- #pragma segment Main
- void DoDiskEvt(EventRecord *eventPtr)
- {
- short ErrResult;
- Point ErrPoint;
-
- if((HiWord(eventPtr->message)!=noErr))
- {
- SetPt(&ErrPoint,100,100);
- ErrResult=DIBadMount(ErrPoint,eventPtr->message);
- }
- }
-